import globalData from '@/plugins/data';
import globalMethods from '@/plugins/methods';
import {useBaseInfoWithOut} from "@/store/modules/base-info";
const useBaseInfo = useBaseInfoWithOut();
/**
 * @description: 展示个人信息弹窗
 * @param {string}id 待显示信息的成员ID
 */
export function showBaseInfo(id) {
  const businessData = useBaseInfo.baseInfo.businessData;
  const {
    currentUser: { id: currentUserId },
  } = businessData;
  let canShowPeopleCard = window.callBackendMethod('orgManager', 'canShowPeopleCard', currentUserId, id);
  if (!canShowPeopleCard) {
    return;
  }
  const dialog = globalMethods.dialog({
    url: `${globalData.ctxPath}/organization/peopleCard.do?method=showPeoPleCard&type=withbutton&memberId=${id}`,
    id: 'pc_new_item',
    footer: null,
    bodyStyle: 'padding: 2px 0px;',
    isHead: false,
    width: 440,
    height: 490,
    closable: false,
    isClear: false,
    transParams: {
      parentWin: {
        newPeopleCardDialog: {
          close: () => dialog.close()
        }
      }
    },
    onCancel() {
      dialog.close();
    }
  });
}
